package com.rk.study03;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * 需求：统计输入文件中每一行的第一个单词相同的行数
 * 输入数据:
 * banzhang ni hao
 * xihuan hadoop banzhang
 * banzhang ni hao
 * xihuan hadoop banzhang
 *
 * 输出数据:
 * banzhang	2
 * xihuan	2
 */
public class KVTextMapper extends Mapper<Text, Text, Text, LongWritable> {

    LongWritable v = new LongWritable(1);

    @Override
    protected void map(Text key, Text value, Context context) throws IOException, InterruptedException {
        context.write(key, v);
    }
}
